import { Directive } from "../type";
import permissionStore from "@/store/modules/permission";
export default {
  name: "permission",
  install: {
    // vnode: Directive.Vnode, prevVnode: Directive.Vnode
    mounted(el: Element, binding: Directive.Binding) {
      const { value, arg } = binding;
      const permissionMap = permissionStore.permissionMap[arg] || { btnAuth: [] };
      if (!permissionMap.btnAuth.includes(value)) {
        el.remove();
      }
    }
  }
};
